#ifndef TEXTURE_H
#define TEXTURE_H

#include <GLee.h>

namespace GL
{

class Texture2D
{
public:
    Texture2D();
    ~Texture2D();
    
    void create(GLint minFilter, GLint magFilter,
                GLint wraptModeS, GLint wraptModeT,
                GLint internalFormat, GLsizei width, GLsizei height,
                GLint border, GLint format, GLenum type,
                GLvoid* pixels = 0);

    void setFormat(GLint internalFormat, GLint format, GLenum type);
    void setTextureUnit(GLenum unit);
    void setTextureData(GLvoid* pixels);
    void resize(GLsizei width, GLsizei height, GLvoid* pixels = 0);
    
    GLuint getId() const;
    void bind() const;
    static void unbind();
    
private:
    static GLenum activateTextureUnit(GLenum unit);
    static GLint bindTexture(GLuint tex);
        
private:
    GLuint  m_Id;
    GLsizei m_Width;
    GLsizei m_Height;
    GLint   m_Format;
    GLenum  m_Type;
    GLint   m_MinFilter;
    GLint   m_MagFilter;
    GLint   m_WraptModeS;
    GLint   m_WraptModeT;
    GLint   m_InternalFormat;
    GLint   m_Border;
    GLenum  m_TexUnit;
};

}

#endif
